﻿Imports System.Collections.ObjectModel

Partial Public Class BindingsSetInCode


    Private Sub BindingsSetInCode_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded

        Me.txtFirstName.SetBinding(TextBox.TextProperty, New Binding("FirstName"))

        Dim b As New Binding
        b.Path = New PropertyPath("LastName")
        Me.txtLastName.SetBinding(TextBox.TextProperty, b)

        b = New Binding
        b.Path = New PropertyPath("Birthday")
        b.StringFormat = "d"
        b.TargetNullValue = String.Empty
        Me.txtBirthday.SetBinding(TextBox.TextProperty, b)


        Me.DataContext = Data.People

    End Sub
End Class
